package org.sixtynine.stock.service.impl;

import java.util.Date;
import java.util.List;

import org.sixtynine.stock.dao.CompanyDocumentDao;
import org.sixtynine.stock.dto.GridPramDTO;
import org.sixtynine.stock.dto.Page;
import org.sixtynine.stock.entity.CompanyDocument;
import org.sixtynine.stock.service.CompanyDocumentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Thilan
 * 
 */
@Service
public class CompanyDocumentServiceImpl implements CompanyDocumentService {

	@Autowired
	private CompanyDocumentDao companyDocumentDao;

	@Override
	public CompanyDocument findById(int id) {
		return companyDocumentDao.findById(id);
	}

	public void saveCompanyDocument(CompanyDocument companyDocument) {
		companyDocumentDao.saveCompanyDocument(companyDocument);
	}

	@Override
	public void deleteCompanyDocument(int id) {
		CompanyDocument companyDocument = companyDocumentDao.findById(id);
		if (companyDocument != null) {
			companyDocumentDao.delete(companyDocument);
		}
	}

	@Override
	public List<CompanyDocument> findCompanyDocument(int id) {
		return companyDocumentDao.findCompanyDocument(id);
	}

	@Override
	public List<CompanyDocument> searchCompanyDocument(int companyId,
			Date fromDate, Date toDate) {
		return companyDocumentDao.searchCompanyDocument(companyId, fromDate,
				toDate);
	}

	@Override
	public Page<CompanyDocument> searchCompanyDocument(int companyId,
			Date fromDate, Date toDate, GridPramDTO gridPramDTO) {
		return companyDocumentDao.searchCompanyDocument(companyId, fromDate,
				toDate, gridPramDTO);
	}

}
